<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html">
    <h:form>
        <h:outputText style="font-weight: bold" value="Choose a purchase order to view from the list below:" />
        <h:selectOneMenu value="#{purchaseOrderBean.purchaseOrderId}">
            <f:selectItems value="#{purchaseOrderBean.purchaseOrderList}" var="q"
                           itemLabel="#{q.id}" itemValue="#{q.id}" />
        </h:selectOneMenu>

        <br/><br/>
        <h:commandButton action="viewPurchaseOrder.xhtml" value="Proceed" actionListener="#{purchaseOrderBean.retrievePurchaseOrderList}"/>
        <br/><br/>
        <h:commandButton action="index.xhtml" value="Return to index" />
        <p></p>
        <i>*If anyone of the fields are blank, it means that the specific data has not been processed yet</i>
        
        <p></p>
        <h:dataTable cellpadding="5px" cellspacing="16px" styleClass="allaroundborder" headerClass="allaroundborder" columnClasses="allaroundborder"
                     rowClasses="allaroundborder" value="#{purchaseOrderBean.purchaseOrderList}" var="purchase">

            <h:column>
                <f:facet name="header">
                    <h:outputText value="Purchase Order Id" />
                </f:facet>
                <h:outputText value="#{purchase.id}" />
            </h:column>

            <h:column>
                <f:facet name="header">
                    <h:outputText value="Quotation Id" />
                </f:facet>
                <h:outputText value="#{purchase.quotationId}" />
            </h:column>

            <h:column>
                <f:facet name="header">
                    <h:outputText value="Submitted By" />
                </f:facet>
                <h:outputText value="#{purchase.submittedBy}" />
            </h:column>

            <h:column>
                <f:facet name="header">
                    <h:outputText value="Date Submitted" />
                </f:facet>
                <h:outputText value="#{purchase.dateSubmitted}" />
            </h:column>
            
            <h:column>
                <f:facet name="header">
                    <h:outputText value="Total Price of Order" />
                </f:facet>
                <h:outputText value="#{purchase.totalPrice}" />
            </h:column>
            
            <h:column>
                <f:facet name="header">
                    <h:outputText value="Sales Order Id" />
                </f:facet>
                <h:outputText value="#{purchase.salesOrderId}" />
            </h:column>
        </h:dataTable>
    </h:form>
</ui:composition>